package com.pt.iwebshop.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.pt.iwebshop.mapper.EbUserMapper;
import com.pt.iwebshop.model.EbUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service//业务证
public class EbUserServiceImpl implements EbUserService {

	@Autowired
	private EbUserMapper ebUserMapper;

	@Override
	public EbUser login(EbUser ebUser) {
		EbUser lgnUser = ebUserMapper.selectOne(Wrappers.<EbUser>lambdaQuery()
				.eq(EbUser::getEuUserId, ebUser.getEuUserId())
				.eq(EbUser::getEuPassword, ebUser.getEuPassword()));
		return lgnUser;
	}

	@Override
	public EbUser register(EbUser ebUser) {
		int result = ebUserMapper.insert(ebUser);
		if(result<=0){
			return null;
		}
		return ebUser;
	}
}









